#! /bin/sh
### BEGIN INIT INFO
# Provides: ec2blkdev
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: ec2blkdev
# Description:       Script to call udevadm to setup any links to
#                    devices already attached at instance launch
# 
### END INIT INFO

PATH=/sbin:/usr/sbin:/bin:/usr/bin
PROG=/sbin/udevadm

do_reread() {
    $PROG trigger --action=change --subsystem-match=block
    retval=$?
    sleep 15 # Wait for EC2 API calls to complete
    return $retval
}

case "$1" in
 start)
   do_reread
   ;;
 stop)
   return
   ;;
 restart)
   do_reread
   ;;
 *)
   echo "Usage: $0 {start|stop|restart}" >&2
   exit 3
   ;;
esac